<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

        /**
         * Config helper
         * @author Bit0reZ (b1t0r3z@gmail.com)
         * @license GNU GPL v3
         * @copyright Bit0reZ
         */

        /**
         * @category TPL helper
         */

        function tpl_dir()
        {
                $CI = &get_instance();
                return $CI->config->item('tpl_dir').'/';
        }

        function tpl_ext()
        {
                $CI = &get_instance();
                return $CI->config->item('tpl_ext');
        }

        function tpl()
        {
                $CI = &get_instance();
                return $CI->config->item('tpl').'/';
        }

        function title()
        {
                $CI = &get_instance();
                return $CI->config->item('title');
        }
        
        function img_dir()
        {
                $CI = &get_instance();
                return $CI->config->item('img_dir').'/';
        }

        /**
         * @category JS helper
         */

        function js_dir()
        {
                $CI = &get_instance();
                return $CI->config->item('js_dir').'/';
        }

        function jquery($latest = false)
        {
                $CI = &get_instance();
                if(!$latest)
                        return $CI->config->item('jquery');
                else
                        return $CI->config->item('jquery_latest');
        }

        function jquery_ui()
        {
                $CI = &get_instance();
                return $CI->config->item('jquery_ui');
        }

        function jquery_url($latest = false)
        {
                $CI = &get_instance();
                if(!$latest)
                        return $CI->config->item('base_url').$CI->config->item('js_dir').'/'.
                                $CI->config->item('jquery');
                else
                        return $CI->config->item('base_url').$CI->config->item('js_dir').'/'.
                                $CI->config->item('jquery_latest');
        }

        function jquery_ui_url()
        {
                $CI = &get_instance();
                return $CI->config->item('base_url').$CI->config->item('js_dir').'/'.
                        $CI->config->item('jquery_ui');
        }

        /**
         * @category CSS helper
         */

        function main_style_url()
        {
                $CI = &get_instance();
                return $CI->config->item('base_url').$CI->config->item('css_dir').'/'.
                        $CI->config->item('main_style');
        }

        function jquery_ui_style_url()
        {
                $CI = &get_instance();
                return $CI->config->item('base_url').$CI->config->item('css_dir').'/'.
                        $CI->config->item('jquery_ui_style');
        }

        /**
         * @category Add-On helper
         */
        
        function wisywig_load()
        {
                $CI = &get_instance();
                $base_url = $CI->config->item('base_url');
                $ww_name = $CI->config->item('wisywig');
                if($ww_name == '') die ;
                $ww = $CI->config->item($ww_name);
                $cont = '';
                foreach($ww['js'] as $val)
                {
                        $cont .= '<script type="text/javascript" src="'.$base_url.
                                $ww['dir'].$val.'"></script>'."\n";
                }
                if($ww['css'] != '')
                {
                        $css_dir = $CI->config->item('css_dir');
                        $cont .= '<link rel="stylesheet" href="'.
                                $base_url.$css_dir.
                                $ww['css'].'" type="text/css" />';
                }
                return $cont;
        }

